<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>布尔值类型转换</title>
</head>
<body>
  <script>
    //转换成布尔值,Boolean()转换为false的情况
      //字符串转布尔值，为false 空字符串
    var str = '1';
    console.log(str,Boolean(str));
      //数值转布尔值，为false的情况 0 0.0 NaN
    var num = 0;
    console.log(num,Boolean(num));
      //对象转布尔值，为false的情况 null
    var obj = {name:'文齐羽',age:22};
    var obj1 = null;
    console.log(obj,Boolean(obj));
    console.log(obj1,Boolean(obj1));
  </script>
</body>
</html>
